package com.atguyigu.codesday01.NotSafeDemo;

import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

public class MapTest {
    public static void main(String[] args)
    {
        Map<String,String> map = new ConcurrentHashMap<>();//Collections.synchronizedSet(new HashSet<>());

        for (int i = 1; i <=30; i++) {
            new Thread(() -> {
                map.put(Thread.currentThread().getName(), UUID.randomUUID().toString().substring(0,6));
                System.out.println(map);
            },String.valueOf(i)).start();
        }

    }

}
